<%@ page import="com.hngc.dao.UserDao" %>
<%@ page import="com.hngc.entity.User" %><%--
  Created by IntelliJ IDEA.
  User: 悠乐美
  Date: 2024/1/10
  Time: 9:03
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<%
    String name = request.getParameter("name");
    String pwd = request.getParameter("pwd");
    int age = Integer.parseInt(request.getParameter("age"));

    UserDao userDao = new UserDao();
    User user = new User(name, pwd, age);
    boolean result = userDao.userReg(user);

    if (result) {
        out.print("<script>alert('注册成功，请登录');location.href='login.jsp'</script>");
        //response.sendRedirect("login.jsp");
    } else {
        response.sendRedirect("reg.jsp");
    }
%>


</body>
</html>
